from pynput import keyboard
from playsound import playsound
from threading import Thread
count = 0
def on_release(key):
    print(key)
    global count
    count += 1
    if count % 10 == 0:
        t = Thread(target=playsound, args=('ding.mp3',))
        t.start()
        #playsound('ding.mp3')
listener = keyboard.Listener(
    on_release=on_release)
listener.start()
listener.join()